package com.eastidea.live.util;

import java.io.File;
import java.util.Hashtable;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang3.StringUtils;

import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.MultiFormatWriter;
import com.google.zxing.client.j2se.MatrixToImageWriter;
import com.google.zxing.common.BitMatrix;

public class RequestUtil {
	
//	QrUtil.genQr("http://192.168.1.228:8080/m/index.html?aid=174", QrUtil.getRootPath(request) +  "upload/qr/" +  
//			id.toString());
	
	public static String getRequestUrl(HttpServletRequest request) {
		String path = request.getRequestURL().toString().split("\\?")[0];
		if (!path.endsWith("/")) {
			path += "/";
		}
		return path;
	}
	
	public static String getAbsolutePath(HttpServletRequest request) {
		String path = request.getSession().getServletContext().getRealPath("/")
				.replaceAll("\\\\", "/");
		if (!path.endsWith("/")) {
			path += "/";
		}
		return path;
	}

}
